from selenium.webdriver.common.by import By

class AdminCouponVoucherRecordsLocator:
    # Promo Management 菜单
    promo_management_menu = (By.XPATH, "//div[contains(@data-menu-id,'PROMO_MANAGER')]")
    # Voucher Records菜单
    voucher_records_menu = (By.CSS_SELECTOR, '[path="/console/voucherRecords"]')


    # voucher records列表属性
    # Voucher No.
    record_list_voucher_no = (By.XPATH, '//th[text() = "Voucher No."]')
    # status
    record_list_status = (By.XPATH, '//span[text() = "Status"]')
    # Voucher Template
    record_list_voucher_template = (By.XPATH, '//th[text() = "Voucher Template"]')
    # Account Email
    record_list_account_email = (By.XPATH, '//th[text() = "Account Email"]')
    # Fixed Amount
    record_list_fixed_amount = (By.XPATH, '//th[text() = "Fixed Amount"]')
    # Balance
    record_list_balance = (By.XPATH, '//th[text() = "Balance"]')
    # Reuse
    record_list_reuse = (By.XPATH, '//th[text() = "Reuse"]')
    # Bind
    record_list_bind = (By.XPATH, '//span[text() = "Bind"]')
    # Validation Period
    record_list_validation_period = (By.XPATH, '//th[text() = "Validation Period (UTC+08:00)"]')


    #搜索输入框
    search_input = (By.XPATH, "//input[contains(@placeholder,'Voucher Template/Voucher No.')]")
    #搜索按钮
    search_button = (By.XPATH, "//button[contains(@class,'antd4-btn antd4-btn-default antd4-btn-icon-only antd4-input-search-button')]")

    # 第一个查询结果的voucher template的值
    first_search_result_voucher_template = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]//td[3]')
    # 第一个查询结果
    first_search_result = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]//td[1]')
    first_search_result_bind = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]//td[8]')

    #状态筛选按钮
    status_filter_button = (By.XPATH, "//span[contains(@class,'antd4-dropdown-trigger antd4-table-filter-trigger')]")
    status_filter_valid_button = (By.XPATH, '(//input[contains(@class,"antd4-checkbox-input")])[1]')
    status_filter_exhausted_button = (By.XPATH, '(//input[contains(@class,"antd4-checkbox-input")])[2]')
    status_filter_expired_button = (By.XPATH, '(//input[contains(@class,"antd4-checkbox-input")])[3]')
    status_filter_ok_button = (By.XPATH, '//button[contains(@class,"antd4-btn antd4-btn-primary antd4-btn-sm")]//span[text()="OK"]')
    status_filter_reset_button = (By.XPATH, '//span[text()="Reset"]')

    #bind 筛选按钮
    bind_filter_button = (By.XPATH, "(//span[contains(@class,'antd4-dropdown-trigger antd4-table-filter-trigger')])[2]")
    bind_filter_ok_button = (By.XPATH, '(//span[text()="OK"])[2]')
    bind_filter_reset_button = (By.XPATH, '(//span[text()="Reset"])[2]')
    bind_filter_y_button = (By.XPATH, '//span[contains(@class,"antd4-dropdown-menu-title-content")]/span[text()="Y"]')
    bind_filter_n_button = (By.XPATH, '//span[contains(@class,"antd4-dropdown-menu-title-content")]/span[text()="N"]')

    #查询结果的数据量
    search_result_num = (By.XPATH, "//li[contains(@class,'antd4-pagination-total-text')]")

